<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户管理</title>
    <link rel="stylesheet" href="../CSS/userManage-css.css">
    <link rel="stylesheet" href="../CSS/font-awesome.css">
</head>
<script src="../js/jquery-3.4.1.min.js"></script>
<body>
<div class="main-div">
    <div class="parcel-div">
        <div class="search-div">
            <form action="http://localhost:8080/FirstProgram/servlet/userData" method="get">
                <input type="hidden" class="hidden-input" name="method" value="query">

                <span>用户名:</span>
                <input type="text" class="userName-input" name="userName" value="${queryUserName}">

                <span>用户角色:</span>
                <select name="userRole" id="select-div">
                    <c:if test="${roleList != null}">
                        <option value="0">- - - -请选择- - - -</option>
                        <c:forEach var="role" items="${roleList}">
                            <option <c:if test="${role.id == queryRoleNo}">selected="selected"</c:if> value="${role.id}">
                                    ${role.roleName}
                            </option>
                        </c:forEach>
                    </c:if>
                </select>

                <input type="hidden" class="hidden-input" name="currentPage" value="1">
                <input type="submit" class="button-input" value="查询">
            </form>
        </div>
        <table class="userTable">
            <tr class="firstTr">
                <th>用户编码</th>
                <th>用户名称</th>
                <th>性别</th>
                <th>年龄</th>
                <th>用户角色</th>
                <th>操作</th>
            </tr>
            <c:forEach var="user" items="${userList}">
                <tr>
                    <td>${user.userCode}</td>
                    <td>${user.userName}</td>
                    <td>
                        <c:if test="${user.gender == 1}">女</c:if>
                        <c:if test="${user.gender == 2}">男</c:if>
                    </td>
                    <td>${user.age}</td>
                    <td>${user.userRoleName}</td>
                    <td>
                        <span class="fa fa-commenting-o"></span>&nbsp;&nbsp;
                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;
                        <span class="fa fa-times"></span>
                    </td>
                </tr>
            </c:forEach>
        </table>
        <input type="hidden" id="totalPageCount" value="${totalPageCount}">
        <c:import url="rolePage.jsp">
            <c:param name="totalUserCount" value="${totalUserCount}"></c:param>
            <c:param name="currentPageNo" value="${currentPageNo}"></c:param>
            <c:param name="totalPageCount" value="${totalPageCount}"></c:param>
        </c:import>
    </div>
</div>
</body>
<script>
    $("tr:even").css("backgroundColor", "rgb(231, 231, 231");
</script>
</html>
